Skip to content

Conversation

@Guikingone
Copy link

@Guikingone Guikingone commented Jun 3, 2020

Note: This PR is opened in order to ease the discussions about the implementation, this is a work in progress 🙂

@Guikingone Guikingone changed the title feat(issue_62): autoconfigure & autowire Context autowiring | autoconfiguration Jun 3, 2020
->scalarNode('class')->defaultNull()->end()
->scalarNode('environment')->defaultNull()->end()
->booleanNode('debug')->defaultNull()->end()
->booleanNode('autoconfigure')->defaultFalse()->end()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess those options are not really related to the kernel configuration, so it should be on the same level with bootstrap and kernel options.


private function handleAutoConfiguration(ContainerBuilder $container): void
{
$container->registerForAutoconfiguration(Context::class)->addTag(self::CONTEXT_TAG);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably won't work, since $container here is Behat's container, not the application's container with all the context services. There's a bundle inside this extension where it is already implemented.

@Yozhef
Copy link
Contributor

Yozhef commented Nov 27, 2022

@Guikingone Hello, let me know if there is an inspiration to continue your work.)

yannickgranger pushed a commit to yannickgranger/SymfonyExtension that referenced this pull request Jan 25, 2026
Extract magic string 'fob.context' to public constant for better
maintainability and discoverability.

Based on upstream PR FriendsOfBehat#125

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
yannickgranger added a commit to yannickgranger/SymfonyExtension that referenced this pull request Jan 25, 2026
* docs: prepare for open-source release and Packagist

- Update composer.json: new package name (yannickgranger/symfony-extension),
  keywords, homepage, support links, branch-alias 3.0-dev
- Update LICENSE: add fork maintainer copyright
- Add CONTRIBUTING.md: development setup, testing, PR guidelines
- Add GitHub templates: issue templates, PR template, CODEOWNERS
- Add CHANGELOG v3.0.0: document all fork changes, new features, fixes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor: extract CONTEXT_TAG constant for context autoconfiguration

Extract magic string 'fob.context' to public constant for better
maintainability and discoverability.

Based on upstream PR FriendsOfBehat#125

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: add context_discovery option for automatic context detection

When enabled, contexts implementing Behat\Context are automatically
discovered from the Symfony container without needing explicit
behat.yml configuration. Uses autoconfigure to tag Context implementers.

- Add DISCOVERED_CONTEXTS_PARAMETER to store discovered context IDs
- Store discovered contexts during container compilation
- Add context_discovery config option (default: false)
- Fall back to discovery when no explicit contexts are available
- Explicit contexts still take precedence when configured

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: GRANGER Yannick <ygranger@softwaymedical.fr>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants